Skip to content

Jab bdms 626#607

Merged
ksmuczynski merged 6 commits intokas-well-BDMS-626-inventory-ingestion-updates_v2from
jab-bdms-626
Mar 18, 2026
Merged

Jab bdms 626#607
ksmuczynski merged 6 commits intokas-well-BDMS-626-inventory-ingestion-updates_v2from
jab-bdms-626

Conversation

@jacob-a-brown
Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • Each contact should have a defined role and contact_type to give them context. Furthermore, there are no records in the csv where there are no defined roles and types

How

Implementation summary - the following was changed / added / removed:

  • Remove alembic scripts that make them nullable
  • Make the database models non-nullable
  • Update well inventory schema to check for role and type if contact data is provided
  • Update tests

Notes

Any special considerations, workarounds, or follow-up work to note?

  • The behave tests were run using the development database. This also has a fix to ensure that ocotilloapi_test is used for feature tests
  • The csv files with the missing role and type data need to use different names since the database is not wiped between scenarios

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens contact validation across the well-inventory CSV import and contact models by requiring role and contact_type whenever contact data is supplied, aligning schema and DB constraints and updating tests/BDD scenarios accordingly.

Changes:

  • Enforce Contact.role and Contact.contact_type as non-nullable in DB/model and schema response/create types.
  • Update well-inventory row validation to require contact role/type when any contact data is present.
  • Update unit tests, BDD feature scenarios/steps, and CSV fixtures to reflect the stricter validation and ensure BDD tests target ocotilloapi_test.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
services/well_inventory_csv.py Adjusts contact payload creation for CSV imports (but introduces a likely Enum/string mismatch for DB inserts).
schemas/well_inventory.py Adds cross-field validation requiring contact role/type when contact data is present.
schemas/contact.py Makes role and contact_type required in request/response schemas.
db/contact.py Makes role and contact_type non-nullable at the ORM level.
tests/test_well_inventory.py Updates expectations for missing contact role/type to fail.
tests/features/well-inventory-csv.feature Switches “missing role/type” scenarios from positive to negative and asserts validation errors.
tests/features/steps/well-inventory-csv-validation-error.py Adds/updates Behave step assertions for the new validation messages (includes a duplicate function name).
tests/features/steps/cli_common.py Improves assertion message for non-zero exit codes.
tests/features/environment.py Forces BDD tests onto the ocotilloapi_test DB (currently hardcodes env overrides).
tests/features/data/*.csv Updates fixtures to include unique names and represent missing role/type cases.
alembic/versions/*.py (deleted) Removes migrations that made contact role/type nullable.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Contributor

@ksmuczynski ksmuczynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Approved

@ksmuczynski ksmuczynski merged commit bf65262 into kas-well-BDMS-626-inventory-ingestion-updates_v2 Mar 18, 2026
5 checks passed
@ksmuczynski ksmuczynski deleted the jab-bdms-626 branch March 18, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants